package org.nextive.android.weightapp.entities;

import android.accounts.AuthenticatorDescription;
import android.content.pm.PackageManager;

public class AccountData 
{
	private String name;
	private String type;
	private String labelType;
	
	public AccountData(String name, AuthenticatorDescription description, PackageManager packageManager)
	{
		this.name = name;
        if (description != null) 
        {
            type = description.type;
        }
        
        String packageName = description.packageName;
        if (description.labelId != 0) 
        {
        	labelType = packageManager.getText(packageName, description.labelId, null).toString();
            if (labelType == null) 
            {
                throw new IllegalArgumentException("LabelID provided, but label not found");
            }
        }
        else 
        {
        	labelType = "";
        }
	}
	
	public String getLabelType() 
	{
		return labelType;
	}

	public void setLabelType(String labelType) 
	{
		this.labelType = labelType;
	}

	public String getName() 
	{
		return name;
	}

	public void setName(String name) 
	{
		this.name = name;
	}

	public String getType() 
	{
		return type;
	}

	public void setType(String type) 
	{
		this.type = type;
	}

	@Override
	public String toString() 
	{
		return this.name;
	}
}
